#include<stdio.h>
int main()
{/*
	int h = 0;
	int b = 0;
	int z =  0;
	while (scanf_s("%d", z) == 1)
	{
		for (h = 0;h < z;h++)
		{
			for (b = 0;b < z;b++)
			{

			}
		}
	}*/
	int y = 0;
	int m = 0;
	int d = 0;
	int day[13] = {0, 31,28,31,30,31,30,31,30,31,30,31 };
	while (scanf("%d %d", &y, &m) == 2)
	{
		d = day[m];
		if (year() == 1 && m == 2)
		{
			d++;
		}
		printf
	}
	return 0;
}